﻿using Inovout.Cloud.Namespace.Models;
using Inovout.Cloud.Namespace.Repositories;
using Inovout.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Inovout.Cloud.Namespace.Services
{
    public class NodeService : RepositoryService<Node>, INodeService
    {
        protected NodeRepository NodeRepository
        {
            get { return (NodeRepository)base.Repository; }
        }

        /// <summary>
        ///  namespace 是否存在
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public bool Exists(string category, string path)
        {
            IList<Node> nodeList = NodeRepository.FindNode(category, path);
            if (nodeList != null && nodeList.Count > 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}
